---
title: "Get Staffing Prediction"
api: "GET https://api-v2.opencopilot.so/backend/reports/{orgId}/agents/staffing-prediction"
description: "Retrieve a prediction for staffing needs based on historical chat data"
---

This endpoint provides a staffing prediction based on historical chat data. It analyzes the number of chats per hour and the number of chats that required human intervention to help optimize agent allocation and improve response times.

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication
</ParamField>

### Path Parameters

<ParamField path="orgId" type="string" required>
  The ID of the organization
</ParamField>

### Query Parameters

<ParamField query="startDate" type="string" format="date-time" optional>
  The start date for the date range to analyze (ISO 8601 format)
</ParamField>

<ParamField query="endDate" type="string" format="date-time" optional>
  The end date for the date range to analyze (ISO 8601 format)
</ParamField>

### Response

<ResponseField name="hourly_chats" type="array">
  An array of objects representing the chat volume and human intervention for each hour
  <Expandable title="properties">
    <ResponseField name="hour" type="number">
      The hour of the day (0-23)
    </ResponseField>
    <ResponseField name="chat_count" type="number">
      The total number of chats during that hour
    </ResponseField>
    <ResponseField name="human_handled_count" type="number">
      The number of chats that required human intervention during that hour
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>

```bash Example Request
curl --location --request GET 'https://api-v2.opencopilot.so/backend/reports/{orgId}/agents/staffing-prediction?startDate=2023-01-01T00:00:00Z&endDate=2023-01-31T23:59:59Z' \
--header 'Authorization: Bearer YOUR_TOKEN'
```

</RequestExample>

<ResponseExample>

```json Response
{
  "hourly_chats": [
    {
      "hour": 0,
      "chat_count": 15,
      "human_handled_count": 3
    },
    {
      "hour": 1,
      "chat_count": 10,
      "human_handled_count": 2
    },
    {
      "hour": 23,
      "chat_count": 20,
      "human_handled_count": 5
    }
  ]
}
```

</ResponseExample>


## How It Works

The feature analyzes historical chat data for a specific organization and generates an hourly breakdown of chat activity. It provides the following information for each hour of the day:

1. Total number of chats
2. Number of chats that required human intervention

## Using the Feature

To use this feature, you need to provide:

1. The organization ID you want to analyze
2. Optional date range for the analysis (start date and end date)

If no date range is specified, the feature will analyze all available historical data.

## Output

The feature returns an array of hourly data points. Each data point includes:

- Hour of the day (0-23)
- Total number of chats for that hour
- Number of chats that required human handling